define(function (require, exports, module) {
    'use strict';
    var Backbone = require('backbone'),
        utils = require('js/utils/tools'),
        helper = require('js/utils/router'),
        path = 'js/apps/op/',
        config = {
            'template': {
                'order': '-updated_at'
            },
            'feedback': {
                'order': '-created_at'
            },
            'show': {
                'order': '-updated_at'
            },
            'bigshow': {
                'order': '-updated_at'
            },
            'virtual': {
                'order': '-updated_at'
            },
            'abtest': {},
            'super_black': {},
            'strategy': {},
            'notify': {
                'order': '-updated_at'
            },
            'in_app_announcement': {
                'order': '-updated_at'
            },
            'notify_internal': {
                'order': '-updated_at'
            },
            'xinge_notification':{
                'order': '-updated_at'
            },
            'withdraw': {
                'order': '-updated_at'
            },
            'withdraw_account': {
            },
            'account_black':{
            },
            'withdraw_black': {
                'order': '-updated_at'
            },
            'recharge': {
                'order': '-updated_at'
            },
            'add_recharge_order': {
                'order': '-created_at',
            },
            'order': {
                'order': '-id'
            },
            'game_order': {
                'order': '-updated_at'
            },
            'large_order': {
                'order': '-created_at'
            },
            'withdraw_control': {
                'order': '-created_at'
            },
            'coupon_tmpl': {
                'order': '-updated_at'
            },
            'bull': {
                'order': '-updated_at',
                'forbidNew': true
            },
            'fruit': {
                'order' : '-updated_at'
            },
            'fruit_part': {
                'order' : '-updated_at'
            },
            'bull_part': {
                'order': '-updated_at',
                'forbidNew': true
            },
            'lottery': {
                'order': '-updated_at',
                'forbidNew': true
            },
            'lottery_part': {
                'order': '-updated_at',
                'forbidNew': true
            },
            'activity': {
                'order': '-id',
            },
            'activity_order': {
                'order': '-id',
            },
            'recharge_wechat': {
            },
            'transaction': {
                'order': '-created_at'
            },
            'add_coin': {
                'order': '-created_at',
            },
            'metis_order': {
                'order': '-create_time',
            },
            'metis_tiger': {
                'order': '-create_time',
                'forbidNew': true
            },
            'metis_tiger_part': {
                'order': '-create_time',
                'forbidNew': true
            },
            'metis_six': {
                'order': '-create_time',
                'forbidNew': true
            },
            'metis_six_part': {
                'order': '-create_time',
                'forbidNew': true
            },
            'withdraw_manage': {
                'order': '-created_at'
            },
            'account_black_customer':{
            },
            'metis_daily_bet': {
            },
            'metis_forbidden': {
            },
            'metis_pass': {
            },
            'coupon': {
            },
        };

    exports.Router = Backbone.Router.extend({
        routes: {
            "op/bigshow/:id/(?*qs)": 'bigShowDetail',   //特殊配置
            "op/show/:id/(?*qs)": 'showDetail',
            "op/:key/(?*qs)": "opList",
            "op/:key/:id/": "opDetail",
        },
        opList: function (key, qs) {
            helper.commonList(key, qs, path, config);
        },
        opDetail: function(key, id){
            helper.commonDetail(key, id, path, config);
        },
        bigShowDetail: function (id, qs) {
            utils.setrs('c');
            var params = utils.parseQueryString(qs),
                conf = {
                    template_id: id,
                    $page: 1,
                    $size: 10,
                    params: params
                };
            require([ path + 'bigshow'], function (view) {
                utils.loadTemplate(view.Detail, function () {
                    var page = new view.Detail(conf);
                    page.render();
                });
            });
        },
        showDetail: function (id, qs) {
            utils.setrs('c');
            var params = {};
            if (id == 'add') {
                params.params = utils.parseQueryString(qs);
            } else {
                params.id = id;
            }
            require([path + 'show'], function (view) {
                utils.loadTemplate(view.Detail, function () {
                    var page = new view.Detail(params);
                    page.render();
                });
            });
        },
    });
});
